﻿Imports System.Data.OleDb

Public Class HauntedLocationsInfo
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub btn_comment_Click(sender As Object, e As EventArgs) Handles btn_comment.Click
        Dim conn As OleDbConnection = New OleDbConnection(ConfigurationManager.ConnectionStrings("HauntedLocationString").ConnectionString)

        Dim sql = "INSERT INTO Comments (Author, Subject, Comment, HauntedLocations_fkid) Values (@f1,@f2,@f3,@f4)"
        Dim cmd = New OleDbCommand(sql, conn)
        conn.Open()
        cmd.Parameters.AddWithValue("@f1", tb_Author.Text)
        cmd.Parameters.AddWithValue("@f2", tb_Subject.Text)
        cmd.Parameters.AddWithValue("@f3", tb_Comment.Text)
        cmd.Parameters.AddWithValue("@f4", Request.Params("ID"))
        cmd.ExecuteNonQuery()
        conn.Close()

        Response.Redirect("MoreDetails.aspx/?ID=" & Request.Params("ID"))

    End Sub
End Class